<!DOCTYPE html>
<html lang="en">
  <head>
    <title>UIPickerView Extension Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>
    <script src="../js/jquery.min.js" defer></script>
    <script src="../js/jazzy.js" defer></script>
    
  </head>
  <body>
    <a name="//apple_ref/swift/Extension/UIPickerView" class="dashAnchor"></a>
    <a title="UIPickerView Extension Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="../index.html">Closures Docs</a></p>
        <p class="header-right"><a href="https://github.com/vhesener/Closures"><img src="../img/gh.png"/>View on GitHub</a></p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="../index.html">Closures Reference</a>
        <img id="carat" src="../img/carat.png" />
        UIPickerView Extension Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="../Controls.html">Controls</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Extensions/UIButton.html">UIButton</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UISwitch.html">UISwitch</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UITextField.html">UITextField</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIDatePicker.html">UIDatePicker</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIPageControl.html">UIPageControl</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UISegmentedControl.html">UISegmentedControl</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIStepper.html">UIStepper</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UISlider.html">UISlider</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIControl.html">UIControl</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIBarButtonItem.html">UIBarButtonItem</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Scrolling Views.html">Scrolling Views</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Extensions/UITableView.html">UITableView</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UICollectionView.html">UICollectionView</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIPickerView.html">UIPickerView</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIScrollView.html">UIScrollView</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Gesture Recognizers.html">Gesture Recognizers</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Extensions/UIGestureRecognizer.html">UIGestureRecognizer</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UITapGestureRecognizer.html">UITapGestureRecognizer</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UILongPressGestureRecognizer.html">UILongPressGestureRecognizer</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIPinchGestureRecognizer.html">UIPinchGestureRecognizer</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIPanGestureRecognizer.html">UIPanGestureRecognizer</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UISwipeGestureRecognizer.html">UISwipeGestureRecognizer</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIRotationGestureRecognizer.html">UIRotationGestureRecognizer</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIScreenEdgePanGestureRecognizer.html">UIScreenEdgePanGestureRecognizer</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIView.html">UIView</a>
              </li>
              <li class="nav-group-task">
                <a href="../Gesture Recognizers.html#/s:8Closures9configure7gesture7handleryx_yxctSo19UIGestureRecognizerCRbzlF">configure(gesture:handler:)</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Controllers.html">Controllers</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Extensions/UIImagePickerController.html">UIImagePickerController</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIImagePickerController/MediaFilter.html">– MediaFilter</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UIImagePickerController/Result.html">– Result</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../KVO.html">KVO</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Extensions/_5FKeyValueCodingAndObserving.html">_KeyValueCodingAndObserving</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            <h1>UIPickerView</h1>
              <div class="declaration">
                <div class="language">
                  <pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">UIPickerView</span></code></pre>

                </div>
              </div>
            <h2 id='delegate-and-datasource' class='heading'>Delegate and DataSource</h2>

<p><code>UIPickerView</code> closures make it easy to implement <code>UIPickerViewDelegate</code> and
 <code>UIPickerViewDataSource</code> protocol methods in an organized way. The following
 is an example of a simple collection view that displays strings in each row.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">loadPickerView</span><span class="p">()</span> <span class="p">{</span>
    <span class="n">pickerView</span>
        <span class="o">.</span><span class="nf">numberOfRowsInComponent</span><span class="p">()</span> <span class="p">{</span> <span class="n">_</span> <span class="k">in</span>
            <span class="n">countries</span><span class="o">.</span><span class="n">count</span>
        <span class="p">}</span><span class="o">.</span><span class="nf">titleForRow</span><span class="p">()</span> <span class="p">{</span> <span class="n">row</span><span class="p">,</span> <span class="n">component</span> <span class="k">in</span>
            <span class="n">countries</span><span class="p">[</span><span class="n">row</span><span class="p">]</span>
        <span class="p">}</span><span class="o">.</span><span class="n">didSelectRow</span> <span class="p">{</span> <span class="n">row</span><span class="p">,</span> <span class="n">component</span> <span class="k">in</span>
            <span class="nf">log</span><span class="p">(</span><span class="s">"</span><span class="se">\(</span><span class="n">countries</span><span class="p">[</span><span class="n">row</span><span class="p">]</span><span class="se">)</span><span class="s"> selected"</span><span class="p">)</span>
        <span class="p">}</span><span class="o">.</span><span class="nf">reloadAllComponents</span><span class="p">()</span>
<span class="p">}</span>
</code></pre>
<h2 id='arrays' class='heading'>Arrays</h2>

<p>These operations are common. Usually, they involve populating the <code>UIPickerView</code>
 with the values from an array. <code>Closures</code> framework gives you a convenient
 way to pass your collection to the table view, so that it can perform the boilerplate
 operations for you, especially the ones that are required to make the picker
 view perform at a basic level.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    Please remember that Swift <code>Array</code>s are value types. This means that they
are copied when mutaded. When the values or sequence of your array changes, you will
need to call one of the <code>add</code> methods again, just before you
call reloadData().

</div>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">loadPickerView</span><span class="p">(</span><span class="nv">countries</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">])</span> <span class="p">{</span>
    <span class="k">let</span> <span class="nv">reversed</span> <span class="o">=</span> <span class="kt">Array</span><span class="p">(</span><span class="n">countries</span><span class="o">.</span><span class="nf">reversed</span><span class="p">())</span>
    <span class="n">pickerView</span>
        <span class="o">.</span><span class="nf">addStrings</span><span class="p">(</span><span class="n">reversed</span><span class="p">)</span> <span class="p">{</span> <span class="n">country</span><span class="p">,</span><span class="n">component</span><span class="p">,</span><span class="n">row</span> <span class="k">in</span>
            <span class="nf">log</span><span class="p">(</span><span class="s">"</span><span class="se">\(</span><span class="n">country</span><span class="se">)</span><span class="s"> selected from array"</span><span class="p">)</span>
        <span class="p">}</span><span class="o">.</span><span class="nf">reloadAllComponents</span><span class="p">()</span>
<span class="p">}</span>
</code></pre>
<div class="aside aside-note">
    <p class="aside-title">Note</p>
    Be sure to note that most of the closure callbacks in these array binding
methods switch the order of the parameters of row and component. Most of the
<code>UIPickerView</code> delegate/datasource method parameters pass <code>row,component</code>. The
parameters on the <code>add</code> methods switch the order and send <code>component,row</code>

</div>
<h3 id='multiple-components' class='heading'>Multiple Components</h3>

<p>And finally, you can just as easily show mutliple components by binding a
 2-dimensional array. When using this method, the outer dimension of the array is the
 component (columns) and the inner dimension are the rows in that component.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">anElement</span> <span class="o">=</span> <span class="n">myTwoDArray</span><span class="p">[</span><span class="n">component</span><span class="p">][</span><span class="n">row</span><span class="p">]</span>
</code></pre>

<p>In this example, the more verbose row handler is provided just to show the
 different variations. Adding multiple components has a convenient method to
 deal with string only arrays also.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">loadPickerView</span><span class="p">(</span><span class="nv">components</span><span class="p">:</span> <span class="p">[[</span><span class="kt">String</span><span class="p">]])</span> <span class="p">{</span>
    <span class="n">pickerView</span><span class="o">.</span><span class="nf">addComponents</span><span class="p">(</span>
        <span class="n">components</span><span class="p">,</span>
        <span class="nv">rowTitle</span><span class="p">:</span> <span class="p">{</span> <span class="n">country</span><span class="p">,</span><span class="n">component</span><span class="p">,</span><span class="n">row</span> <span class="k">in</span>
            <span class="n">country</span><span class="p">},</span>
        <span class="nv">didSelect</span><span class="p">:</span> <span class="p">{</span> <span class="n">country</span><span class="p">,</span><span class="n">component</span><span class="p">,</span><span class="n">row</span> <span class="k">in</span>
            <span class="nf">log</span><span class="p">(</span><span class="s">"</span><span class="se">\(</span><span class="n">country</span><span class="se">)</span><span class="s"> selected from 2D Array"</span><span class="p">)</span>
    <span class="p">})</span>

    <span class="cm">/**
     This also allows you to override any default behavior so
     you aren't overly committed, even though you're initially binding everything
     to the `Array`.
     */</span>
    <span class="n">pickerView</span><span class="o">.</span><span class="n">widthForComponent</span> <span class="p">{</span> <span class="n">component</span> <span class="k">in</span>
        <span class="n">component</span> <span class="o">==</span>  <span class="mi">0</span> <span class="p">?</span> <span class="mi">200</span> <span class="p">:</span> <span class="mi">100</span>
    <span class="p">}</span><span class="o">.</span><span class="nf">reloadAllComponents</span><span class="p">()</span>
<span class="p">}</span>
</code></pre>

          </section>
          <section class="section task-group-section">
            <div class="task-group">
              <div class="task-name-container">
                <a name="/Common%20Array%20Usage"></a>
                <a name="//apple_ref/swift/Section/Common Array Usage" class="dashAnchor"></a>
                <a href="#/Common%20Array%20Usage">
                  <h3 class="section-name">Common Array Usage</h3>
                </a>
              </div>
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE10addStrings_9didSelectABXDSaySSG_ySS_S2itctF"></a>
                    <a name="//apple_ref/swift/Method/addStrings(_:didSelect:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE10addStrings_9didSelectABXDSaySSG_ySS_S2itctF">addStrings(_:didSelect:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>This method defaults many of the boilerplate callbacks needed to populate a
UIPickerView when using an <code>Array</code> as a data source.
The defaults that this method takes care of:</p>

<ul>
<li>Provides the number of components</li>
<li>Provides the number of rows</li>
<li>Handles the pickerView(_:didSelectRow:inComponent:) delegate method</li>
<li>Provides the title string for each row</li>
</ul>

<p>This method simply sets basic default behavior. This means that you can
override the default picker view handlers after this method is called.
However, remember that order matters. If you call this method after you
override the <code>numberOfComponents</code> callback, for instance, the closure
you passed into <code>numberOfComponents</code> will be wiped out by this method
and you will have to override that closure handler again.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    Please remember that Swift <code>Array</code>s are value types. This means that they
are copied when mutaded. When the values or sequence of your array changes, you will
need to call this method again, just before you call reloadComponent()
or reloadAllComponents(). If you have a lot of picker view customization
in addtion to a lot of updates to your array, it is more appropriate to use the individual
closure handlers instead of this method.

</div>

<hr>
<h4 id='an-example-of-calling-this-method' class='heading'>An example of calling this method:</h4>
<pre class="highlight swift"><code><span class="n">pickerView</span><span class="o">.</span><span class="nf">addStrings</span><span class="p">(</span><span class="o">&lt;</span><span class="err">#</span><span class="n">myArray</span><span class="err">#</span><span class="o">&gt;</span><span class="p">)</span> <span class="p">{</span> <span class="n">aTitle</span><span class="p">,</span><span class="n">component</span><span class="p">,</span><span class="n">row</span> <span class="k">in</span>
    <span class="nf">print</span><span class="p">(</span><span class="s">"</span><span class="se">\(</span><span class="n">aTitle</span><span class="se">)</span><span class="s"> was selected"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">addStrings</span><span class="p">(</span><span class="n">_</span> <span class="nv">strings</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">],</span>
                       <span class="nv">didSelect</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">element</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>strings</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>An <code>Array</code> of <code>String</code>s to be used for each row in a single component picker view.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>didSelect</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A closure that is called when the UIPickerView&rsquo;s value has been selected.</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate/datasource calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE11addElements_8rowTitle9didSelectABXDSayxG_SSx_S2itcyx_S2itctlF"></a>
                    <a name="//apple_ref/swift/Method/addElements(_:rowTitle:didSelect:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE11addElements_8rowTitle9didSelectABXDSayxG_SSx_S2itcyx_S2itctlF">addElements(_:rowTitle:didSelect:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>This method defaults many of the boilerplate callbacks needed to populate a
UIPickerView when using an <code>Array</code> as a data source.
The defaults that this method takes care of:</p>

<ul>
<li>Provides the number of components</li>
<li>Provides the number of rows</li>
<li>Handles the pickerView(_:titleForRow:forComponent:) delegate method</li>
<li>Handles the pickerView(_:didSelectRow:inComponent:) delegate method</li>
</ul>

<p>This method simply sets basic default behavior. This means that you can
override the default picker view handlers after this method is called.
However, remember that order matters. If you call this method after you
override the <code>numberOfComponents</code> callback, for instance, the closure
you passed into <code>numberOfComponents</code> will be wiped out by this method
and you will have to override that closure handler again.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>Please remember that Swift <code>Array</code>s are value types. This means that they
are copied when mutaded. When the values or sequence of your array changes, you will
need to call this method again, just before you call reloadComponent()
or reloadAllComponents(). If you have a lot of picker view customization
in addtion to a lot of updates to your array, it is more appropriate to use the individual
closure handlers instead of this method.</p>

</div>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>Be sure to note that most of the closure callbacks in these array binding
methods switch the order of the parameters of row and component. Most of the
UIPickerView delegate/datasource method parameters have row,component. The
handlers&rsquo; parameters on the <code>add</code> methods send component,row.</p>

</div>

<hr>
<h4 id='an-example-of-calling-this-method' class='heading'>An example of calling this method:</h4>
<pre class="highlight swift"><code><span class="n">pickerView</span><span class="o">.</span><span class="nf">addElements</span><span class="p">(</span>
    <span class="o">&lt;</span><span class="err">#</span><span class="n">myArray</span><span class="err">#</span><span class="o">&gt;</span><span class="p">,</span>
    <span class="nv">rowTitle</span><span class="p">:</span> <span class="p">{</span> <span class="n">element</span><span class="p">,</span> <span class="n">component</span><span class="p">,</span> <span class="n">row</span> <span class="k">in</span>
        <span class="k">return</span> <span class="o">&lt;</span><span class="err">#</span><span class="nf">aTitle</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">element</span><span class="p">)</span><span class="err">#</span><span class="o">&gt;</span><span class="p">},</span>
    <span class="nv">didSelect</span><span class="p">:</span> <span class="p">{</span> <span class="n">element</span><span class="p">,</span> <span class="n">component</span><span class="p">,</span> <span class="n">row</span> <span class="k">in</span>
        <span class="nf">print</span><span class="p">(</span><span class="s">"</span><span class="se">\(</span><span class="n">element</span><span class="se">)</span><span class="s"> was selected"</span><span class="p">)</span>
<span class="p">)</span>
</code></pre>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="n">addElements</span><span class="o">&lt;</span><span class="kt">Element</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">elements</span><span class="p">:</span> <span class="p">[</span><span class="kt">Element</span><span class="p">],</span>
                                 <span class="nv">rowTitle</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">element</span><span class="p">:</span> <span class="kt">Element</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">String</span><span class="p">,</span>
                                 <span class="nv">didSelect</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">element</span><span class="p">:</span> <span class="kt">Element</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>strings</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>An <code>Array</code> of any type to be used for each row in a single component picker view.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>rowTitle</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A closure that is called when the UIPickerView needs to display a string for it&rsquo;s row.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>didSelect</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A closure that is called when the UIPickerView&rsquo;s value has been selected.</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate/datasource calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE11addElements_03rowB09didSelectABXDSayxG_So6UIViewCx_AISgS2itcyx_S2itctlF"></a>
                    <a name="//apple_ref/swift/Method/addElements(_:rowView:didSelect:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE11addElements_03rowB09didSelectABXDSayxG_So6UIViewCx_AISgS2itcyx_S2itctlF">addElements(_:rowView:didSelect:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>This method defaults many of the boilerplate callbacks needed to populate a
UIPickerView when using an <code>Array</code> as a data source.
The defaults that this method takes care of:</p>

<ul>
<li>Provides the number of components</li>
<li>Provides the number of rows</li>
<li>Handles the pickerView(_:viewForRow:forComponent:) delegate method</li>
<li>Handles the pickerView(_:didSelectRow:inComponent:) delegate method</li>
</ul>

<p>This method simply sets basic default behavior. This means that you can
override the default picker view handlers after this method is called.
However, remember that order matters. If you call this method after you
override the <code>numberOfComponents</code> callback, for instance, the closure
you passed into <code>numberOfComponents</code> will be wiped out by this method
and you will have to override that closure handler again.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>Please remember that Swift <code>Array</code>s are value types. This means that they
are copied when mutaded. When the values or sequence of your array changes, you will
need to call this method again, just before you call reloadComponent()
or reloadAllComponents(). If you have a lot of picker view customization
in addtion to a lot of updates to your array, it is more appropriate to use the individual
closure handlers instead of this method.</p>

</div>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>Be sure to note that most of the closure callbacks in these array binding
methods switch the order of the parameters of row and component. Most of the
UIPickerView delegate/datasource method parameters have row,component. The
handlers&rsquo; parameters on the <code>add</code> methods send component,row.</p>

</div>

<hr>
<h4 id='an-example-of-calling-this-method' class='heading'>An example of calling this method:</h4>
<pre class="highlight swift"><code><span class="n">pickerView</span><span class="o">.</span><span class="nf">addElements</span><span class="p">(</span>
    <span class="o">&lt;</span><span class="err">#</span><span class="n">myArray</span><span class="err">#</span><span class="o">&gt;</span><span class="p">,</span>
    <span class="nv">rowView</span><span class="p">:</span> <span class="p">{</span> <span class="n">element</span><span class="p">,</span> <span class="n">reuseView</span><span class="p">,</span> <span class="n">component</span><span class="p">,</span> <span class="n">row</span> <span class="k">in</span>
        <span class="k">return</span> <span class="o">&lt;</span><span class="err">#</span><span class="nf">aView</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">element</span><span class="p">)</span><span class="err">#</span><span class="o">&gt;</span><span class="p">},</span>
    <span class="nv">didSelect</span><span class="p">:</span> <span class="p">{</span> <span class="n">element</span><span class="p">,</span> <span class="n">component</span><span class="p">,</span> <span class="n">row</span> <span class="k">in</span>
        <span class="nf">print</span><span class="p">(</span><span class="s">"</span><span class="se">\(</span><span class="n">element</span><span class="se">)</span><span class="s"> was selected"</span><span class="p">)</span>
<span class="p">)</span>
</code></pre>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="n">addElements</span><span class="o">&lt;</span><span class="kt">Element</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">elements</span><span class="p">:</span> <span class="p">[</span><span class="kt">Element</span><span class="p">],</span>
                                 <span class="nv">rowView</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">element</span><span class="p">:</span> <span class="kt">Element</span><span class="p">,</span> <span class="n">_</span> <span class="nv">reuseView</span><span class="p">:</span> <span class="kt">UIView</span><span class="p">?,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">UIView</span><span class="p">,</span>
                                 <span class="nv">didSelect</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">element</span><span class="p">:</span> <span class="kt">Element</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>strings</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>An <code>Array</code> of any type to be used for each row in a single component picker view.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>rowView</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A closure that is called when the UIPickerView needs to display a view for it&rsquo;s row.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>didSelect</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A closure that is called when the UIPickerView&rsquo;s value has been selected.</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate/datasource calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE13addComponents_9didSelectABXDSaySaySSGG_ySS_S2itctF"></a>
                    <a name="//apple_ref/swift/Method/addComponents(_:didSelect:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE13addComponents_9didSelectABXDSaySaySSGG_ySS_S2itctF">addComponents(_:didSelect:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>This method defaults many of the boilerplate callbacks needed to populate a
UIPickerView when using a two-dimensional Array as a data source.
The defaults that this method takes care of:</p>

<ul>
<li>Provides the number of components</li>
<li>Provides the number of rows</li>
<li>Handles the pickerView(_:didSelectRow:inComponent:) delegate method</li>
<li>Provides the title string for each row</li>
</ul>

<p>This method simply sets basic default behavior. This means that you can
override the default picker view handlers after this method is called.
However, remember that order matters. If you call this method after you
override the <code>numberOfComponents</code> callback, for instance, the closure
you passed into <code>numberOfComponents</code> will be wiped out by this method
and you will have to override that closure handler again.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    Please remember that Swift <code>Array</code>s are value types. This means that they
are copied when mutaded. When the values or sequence of your array changes, you will
need to call this method again, just before you call reloadComponent()
or reloadAllComponents(). If you have a lot of picker view customization
in addtion to a lot of updates to your array, it is more appropriate to use the individual
closure handlers instead of this method.

</div>

<hr>
<h4 id='an-example-of-calling-this-method' class='heading'>An example of calling this method:</h4>
<pre class="highlight swift"><code><span class="n">pickerView</span><span class="o">.</span><span class="nf">addComponents</span><span class="p">(</span><span class="o">&lt;</span><span class="err">#</span><span class="n">my2DArray</span><span class="err">#</span><span class="o">&gt;</span><span class="p">)</span> <span class="p">{</span> <span class="n">aTitle</span><span class="p">,</span><span class="n">component</span><span class="p">,</span><span class="n">row</span> <span class="k">in</span>
    <span class="nf">print</span><span class="p">(</span><span class="s">"</span><span class="se">\(</span><span class="n">aTitle</span><span class="se">)</span><span class="s"> was selected"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">addComponents</span><span class="p">(</span><span class="n">_</span> <span class="nv">strings</span><span class="p">:</span> <span class="p">[[</span><span class="kt">String</span><span class="p">]],</span>
                          <span class="nv">didSelect</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">element</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>strings</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>An <code>Array</code> of <code>Array</code> of <code>String</code>s to be used for each row and component in a picker view.
The outer dimension of the array is the component (columns) and the inner dimension are the rows in that component.
e.g. myTwoDArray[component][row]</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>didSelect</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A closure that is called when the UIPickerView&rsquo;s value has been selected.</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate/datasource calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE13addComponents_8rowTitle9didSelectABXDSaySayxGG_SSx_S2itcyx_S2itctlF"></a>
                    <a name="//apple_ref/swift/Method/addComponents(_:rowTitle:didSelect:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE13addComponents_8rowTitle9didSelectABXDSaySayxGG_SSx_S2itcyx_S2itctlF">addComponents(_:rowTitle:didSelect:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>This method defaults many of the boilerplate callbacks needed to populate a
UIPickerView when using a two-dimensional Array as a data source.
The defaults that this method takes care of:</p>

<ul>
<li>Provides the number of components</li>
<li>Provides the number of rows</li>
<li>Handles the pickerView(_:titleForRow:forComponent:) delegate method</li>
<li>Handles the pickerView(_:didSelectRow:inComponent:) delegate method</li>
</ul>

<p>This method simply sets basic default behavior. This means that you can
override the default picker view handlers after this method is called.
However, remember that order matters. If you call this method after you
override the <code>numberOfComponents</code> callback, for instance, the closure
you passed into <code>numberOfComponents</code> will be wiped out by this method
and you will have to override that closure handler again.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>Please remember that Swift <code>Array</code>s are value types. This means that they
are copied when mutaded. When the values or sequence of your array changes, you will
need to call this method again, just before you call reloadComponent()
or reloadAllComponents(). If you have a lot of picker view customization
in addtion to a lot of updates to your array, it is more appropriate to use the individual
closure handlers instead of this method.</p>

</div>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>Be sure to note that most of the closure callbacks in these array binding
methods switch the order of the parameters of row and component. Most of the
UIPickerView delegate/datasource method parameters have row,component. The
handlers&rsquo; parameters on the <code>add</code> methods send component,row.</p>

</div>

<hr>
<h4 id='an-example-of-calling-this-method' class='heading'>An example of calling this method:</h4>
<pre class="highlight swift"><code><span class="n">pickerView</span><span class="o">.</span><span class="nf">addComponents</span><span class="p">(</span>
    <span class="o">&lt;</span><span class="err">#</span><span class="n">my2DArray</span><span class="err">#</span><span class="o">&gt;</span><span class="p">,</span>
    <span class="nv">rowTitle</span><span class="p">:</span> <span class="p">{</span> <span class="n">element</span><span class="p">,</span> <span class="n">component</span><span class="p">,</span> <span class="n">row</span> <span class="k">in</span>
        <span class="k">return</span> <span class="o">&lt;</span><span class="err">#</span><span class="nf">aTitle</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">element</span><span class="p">,</span> <span class="nv">componentIdx</span><span class="p">:</span> <span class="n">component</span><span class="p">)</span><span class="err">#</span><span class="o">&gt;</span><span class="p">},</span>
    <span class="nv">didSelect</span><span class="p">:</span> <span class="p">{</span> <span class="n">element</span><span class="p">,</span> <span class="n">component</span><span class="p">,</span> <span class="n">row</span> <span class="k">in</span>
        <span class="nf">print</span><span class="p">(</span><span class="s">"</span><span class="se">\(</span><span class="n">element</span><span class="se">)</span><span class="s"> was selected"</span><span class="p">)</span>
<span class="p">)</span>
</code></pre>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="n">addComponents</span><span class="o">&lt;</span><span class="kt">Element</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">components</span><span class="p">:</span> <span class="p">[[</span><span class="kt">Element</span><span class="p">]],</span>
                                   <span class="nv">rowTitle</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">element</span><span class="p">:</span> <span class="kt">Element</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">String</span><span class="p">,</span>
                                   <span class="nv">didSelect</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">element</span><span class="p">:</span> <span class="kt">Element</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>components</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>An <code>Array</code> of <code>Array</code> of any type to be used for each row and component in a picker view.
The outer dimension of the array is the component (columns) and the inner dimension are the rows in that component.
e.g. myTwoDArray[component][row]</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>rowTitle</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A closure that is called when the UIPickerView needs to display a string for it&rsquo;s row.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>didSelect</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A closure that is called when the UIPickerView&rsquo;s value has been selected.</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate/datasource calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE13addComponents_03rowB09didSelectABXDSaySayxGG_So6UIViewCx_AJSgS2itcyx_S2itctlF"></a>
                    <a name="//apple_ref/swift/Method/addComponents(_:rowView:didSelect:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE13addComponents_03rowB09didSelectABXDSaySayxGG_So6UIViewCx_AJSgS2itcyx_S2itctlF">addComponents(_:rowView:didSelect:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>This method defaults many of the boilerplate callbacks needed to populate a
UIPickerView when using a two-dimensional Array as a data source.
The defaults that this method takes care of:</p>

<ul>
<li>Provides the number of components</li>
<li>Provides the number of rows</li>
<li>Handles the pickerView(_:viewForRow:forComponent:) delegate method</li>
<li>Handles the pickerView(_:didSelectRow:inComponent:) delegate method</li>
</ul>

<p>This method simply sets basic default behavior. This means that you can
override the default picker view handlers after this method is called.
However, remember that order matters. If you call this method after you
override the <code>numberOfComponents</code> callback, for instance, the closure
you passed into <code>numberOfComponents</code> will be wiped out by this method
and you will have to override that closure handler again.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>Please remember that Swift <code>Array</code>s are value types. This means that they
are copied when mutaded. When the values or sequence of your array changes, you will
need to call this method again, just before you call reloadComponent()
or reloadAllComponents(). If you have a lot of picker view customization
in addtion to a lot of updates to your array, it is more appropriate to use the individual
closure handlers instead of this method.</p>

</div>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>Be sure to note that most of the closure callbacks in these array binding
methods switch the order of the parameters of row and component. Most of the
UIPickerView delegate/datasource method parameters have row,component. The
handlers&rsquo; parameters on the <code>add</code> methods send component,row.</p>

</div>

<hr>
<h4 id='an-example-of-calling-this-method' class='heading'>An example of calling this method:</h4>
<pre class="highlight swift"><code><span class="n">pickerView</span><span class="o">.</span><span class="nf">addComponents</span><span class="p">(</span>
    <span class="o">&lt;</span><span class="err">#</span><span class="n">my2DArray</span><span class="err">#</span><span class="o">&gt;</span><span class="p">,</span>
    <span class="nv">rowView</span><span class="p">:</span> <span class="p">{</span> <span class="n">element</span><span class="p">,</span> <span class="n">reuseView</span><span class="p">,</span> <span class="n">component</span><span class="p">,</span> <span class="n">row</span> <span class="k">in</span>
        <span class="k">return</span> <span class="o">&lt;</span><span class="err">#</span><span class="nf">aView</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">element</span><span class="p">,</span> <span class="nv">componentIdx</span><span class="p">:</span> <span class="n">component</span><span class="p">)</span><span class="err">#</span><span class="o">&gt;</span><span class="p">},</span>
    <span class="nv">didSelect</span><span class="p">:</span> <span class="p">{</span> <span class="n">element</span><span class="p">,</span> <span class="n">component</span><span class="p">,</span> <span class="n">row</span> <span class="k">in</span>
        <span class="nf">print</span><span class="p">(</span><span class="s">"</span><span class="se">\(</span><span class="n">element</span><span class="se">)</span><span class="s"> was selected"</span><span class="p">)</span>
<span class="p">)</span>
</code></pre>

<p>parameter components: An <code>Array</code> of <code>Array</code> of any type to be used for each row and component in a picker view.
The outer dimension of the array is the component (columns) and the inner dimension are the rows in that component.
e.g. myTwoDArray[component][row]</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="n">addComponents</span><span class="o">&lt;</span><span class="kt">Element</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">components</span><span class="p">:</span> <span class="p">[[</span><span class="kt">Element</span><span class="p">]],</span>
                                   <span class="nv">rowView</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">element</span><span class="p">:</span> <span class="kt">Element</span><span class="p">,</span> <span class="n">_</span> <span class="nv">reuseView</span><span class="p">:</span> <span class="kt">UIView</span><span class="p">?,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">UIView</span><span class="p">,</span>
                                   <span class="nv">didSelect</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">element</span><span class="p">:</span> <span class="kt">Element</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>rowView</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A closure that is called when the UIPickerView needs to display a view for it&rsquo;s row.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>didSelect</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>A closure that is called when the UIPickerView&rsquo;s value has been selected.</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate/datasource calls</p>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <div class="task-name-container">
                <a name="/Delegate%20and%20DataSource%20Overrides"></a>
                <a name="//apple_ref/swift/Section/Delegate and DataSource Overrides" class="dashAnchor"></a>
                <a href="#/Delegate%20and%20DataSource%20Overrides">
                  <h3 class="section-name">Delegate and DataSource Overrides</h3>
                </a>
              </div>
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE21rowHeightForComponent7handlerABXD12CoreGraphics7CGFloatVSic_tF"></a>
                    <a name="//apple_ref/swift/Method/rowHeightForComponent(handler:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE21rowHeightForComponent7handlerABXD12CoreGraphics7CGFloatVSic_tF">rowHeightForComponent(handler:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Equivalent to implementing UIPickerViewDelegate&rsquo;s pickerView(_:rowHeightForComponent:) method</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">rowHeightForComponent</span><span class="p">(</span><span class="nv">handler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">CGFloat</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>handler</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The closure that will be called in place of its equivalent delegate method</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE17widthForComponent7handlerABXD12CoreGraphics7CGFloatVSic_tF"></a>
                    <a name="//apple_ref/swift/Method/widthForComponent(handler:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE17widthForComponent7handlerABXD12CoreGraphics7CGFloatVSic_tF">widthForComponent(handler:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Equivalent to implementing UIPickerViewDelegate&rsquo;s pickerView(_:widthForComponent:) method</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">widthForComponent</span><span class="p">(</span><span class="nv">handler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">CGFloat</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>handler</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The closure that will be called in place of its equivalent delegate method</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE11titleForRow7handlerABXDSSSgSi_Sitc_tF"></a>
                    <a name="//apple_ref/swift/Method/titleForRow(handler:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE11titleForRow7handlerABXDSSSgSi_Sitc_tF">titleForRow(handler:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Equivalent to implementing UIPickerViewDelegate&rsquo;s pickerView(_:titleForRow:forComponent:) method</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">titleForRow</span><span class="p">(</span><span class="nv">handler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">String</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>handler</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The closure that will be called in place of its equivalent delegate method</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE21attributedTitleForRow7handlerABXDSo18NSAttributedStringCSgSi_Sitc_tF"></a>
                    <a name="//apple_ref/swift/Method/attributedTitleForRow(handler:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE21attributedTitleForRow7handlerABXDSo18NSAttributedStringCSgSi_Sitc_tF">attributedTitleForRow(handler:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Equivalent to implementing UIPickerViewDelegate&rsquo;s pickerView(_:attributedTitleForRow:forComponent:) method</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">attributedTitleForRow</span><span class="p">(</span><span class="nv">handler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">NSAttributedString</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>handler</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The closure that will be called in place of its equivalent delegate method</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE10viewForRow7handlerABXDSo6UIViewCSi_SiAGSgtc_tF"></a>
                    <a name="//apple_ref/swift/Method/viewForRow(handler:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE10viewForRow7handlerABXDSo6UIViewCSi_SiAGSgtc_tF">viewForRow(handler:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Equivalent to implementing UIPickerViewDelegate&rsquo;s pickerView(_:viewForRow:forComponent:reusing:) method</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">viewForRow</span><span class="p">(</span><span class="nv">handler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">reusingView</span><span class="p">:</span> <span class="kt">UIView</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">UIView</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>handler</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The closure that will be called in place of its equivalent delegate method</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE12didSelectRow7handlerABXDySi_Sitc_tF"></a>
                    <a name="//apple_ref/swift/Method/didSelectRow(handler:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE12didSelectRow7handlerABXDySi_Sitc_tF">didSelectRow(handler:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Equivalent to implementing UIPickerViewDelegate&rsquo;s pickerView(_:didSelectRow:inComponent:) method</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">didSelectRow</span><span class="p">(</span><span class="nv">handler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">row</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>handler</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The closure that will be called in place of its equivalent delegate method</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other delegate calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE18numberOfComponents7handlerABXDSiyc_tF"></a>
                    <a name="//apple_ref/swift/Method/numberOfComponents(handler:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE18numberOfComponents7handlerABXDSiyc_tF">numberOfComponents(handler:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Equivalent to implementing UIPickerViewDataSource&rsquo;s numberOfComponents(in:) method</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">numberOfComponents</span><span class="p">(</span><span class="nv">handler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">()</span> <span class="o">-&gt;</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>handler</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The closure that will be called in place of its equivalent dataSource method</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other dataSource calls</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:So12UIPickerViewC8ClosuresE23numberOfRowsInComponent7handlerABXDS2ic_tF"></a>
                    <a name="//apple_ref/swift/Method/numberOfRowsInComponent(handler:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:So12UIPickerViewC8ClosuresE23numberOfRowsInComponent7handlerABXDS2ic_tF">numberOfRowsInComponent(handler:)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Equivalent to implementing UIPickerViewDataSource&rsquo;s pickerView(_:numberOfRowsInComponent:) method</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">numberOfRowsInComponent</span><span class="p">(</span><span class="nv">handler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="n">_</span> <span class="nv">component</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>handler</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>The closure that will be called in place of its equivalent dataSource method</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>itself so you can daisy chain the other dataSource calls</p>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <div class="task-name-container">
                <a name="/Reset"></a>
                <a name="//apple_ref/swift/Section/Reset" class="dashAnchor"></a>
                <a href="#/Reset">
                  <h3 class="section-name">Reset</h3>
                </a>
              </div>
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/c:@CM@Closures@@objc(cs)UIPickerView(im)clearClosureDelegates"></a>
                    <a name="//apple_ref/swift/Method/clearClosureDelegates()" class="dashAnchor"></a>
                    <a class="token" href="#/c:@CM@Closures@@objc(cs)UIPickerView(im)clearClosureDelegates">clearClosureDelegates()</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Clears any delegate/dataSource closures that were assigned to this
<code>UIPickerView</code>. This cleans up memory as well as sets the
delegate/dataSource properties to nil. This is typically only used for explicit
cleanup. You are not required to call this method.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@objc</span>
<span class="kd">public</span> <span class="kd">func</span> <span class="nf">clearClosureDelegates</span><span class="p">()</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </section>
        </section>
        <section id="footer">
          <p>2017 Vincent Hesener</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>
